﻿@namespace BootstrapBlazor.Components
@inherits IdComponentBase

<div @attributes="@AdditionalAttributes" id="@Id" class="@HeaderClassString">
    <Tab IsBorderCard="true" IsOnlyRenderActiveTab="true" OnClickTab="OnClickTab">
        @foreach (var item in GetItems())
        {
            <TabItem Text="@item.Text">
                <div class="tab-commands">
                    @foreach (var groups in item.Items.OfType<RibbonTabItem>().GroupBy(s => s.GroupName))
                    {
                        <div class="link-group">
                            <div class="d-flex">
                                @foreach (var group in groups)
                                {
                                    <LinkButton Icon="@group.Icon" ImageUrl="@group.ImageUrl" IsDisabled="@group.IsDisabled" Text="@group.Text" IsVertical="true" Color="Color.Secondary" class="@GetClassString(group)" StopPropagation="true" OnClick="() => OnClick(group)" />
                                }
                            </div>
                            <div class="link-group-name">
                                @groups.Key
                            </div>
                        </div>
                        <Divider IsVertical="true" />
                    }
                </div>
            </TabItem>
        }
    </Tab>
    <div class="ribbon-buttons">
        @if (RightButtonsTemplate != null)
        {
            <div class="ribbon-customer-buttons">
                @RightButtonsTemplate
            </div>
        }
        @if (ShowFloatButton)
        {
            <div class="ribbon-arrow">
                <i class="@ArrowIconClassString" @onclick="OnToggleFloat"></i>
            </div>
        }
    </div>
</div>
